/**
 * Copyright (c) Software Institude of PKU
 * All rights reserved. 
 * This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 */
package edu.pku.sei.modeler.model.uml.Communications;
// imports:
import org.w3c.dom.Element;

import edu.pku.sei.gefcommon.descriptor.annotation.MethodProperty;
import edu.pku.sei.modeler.model.common.*;
import edu.pku.sei.modeler.model.core.*;
import edu.pku.sei.modeler.model.xml.XMLUtility;

import edu.pku.sei.modeler.model.uml.Kernel.ValueSpecification;
import edu.pku.sei.modeler.model.uml.SimpleTime.TimeExpression;
import edu.pku.sei.modeler.uml.modelHelper.ModelPackage;


/**
 * @generated
 *
 */
public class TimeEvent extends Event implements ITimeEvent {
	// attributes
	
	protected boolean isRelative;
	
	protected ValueSpecification when;
	
	protected TimeExpression redefinedWhen;
	
	
	
	
	// references
	
	
	
	// getters & setters for attributes
	
	@MethodProperty(
			id = "TIMEEVENT_ISRELATIVE",
			catalog = "Model",
			name = ModelPackage.TIMEEVENT_ISRELATIVE,
			setter = "setisRelative"
			)
	
	public boolean getIsRelative() {
		return isRelative;
	}
	public void setIsRelative(boolean newIsRelative) {
		boolean oldisRelative = isRelative;
		isRelative = newIsRelative;
		firePropertyChange(ModelPackage.TIMEEVENT_ISRELATIVE, oldisRelative, newIsRelative);
	}
	
	public ValueSpecification getWhen() {
		return when;
	}
	public void setWhen(ValueSpecification newWhen) {
		ValueSpecification oldwhen = when;
		when = newWhen;
		firePropertyChange(ModelPackage.TIMEEVENT_WHEN, oldwhen, newWhen);
	}
	
	public TimeExpression getRedefinedWhen() {
		return redefinedWhen;
	}
	public void setRedefinedWhen(TimeExpression newRedefinedWhen) {
		TimeExpression oldredefinedWhen = redefinedWhen;
		redefinedWhen = newRedefinedWhen;
		firePropertyChange(ModelPackage.TIMEEVENT_REDEFINEDWHEN, oldredefinedWhen, newRedefinedWhen);
	}
	
	// getters for references
	
	// save & load
	public void serialize(Element root) {
		super.serialize(root);
		// attributes
		
		XMLUtility.xmlInstance.serializeAttribute(root, ModelPackage.TIMEEVENT_ISRELATIVE, isRelative);
		
		XMLUtility.xmlInstance.serializeNode(root, ModelPackage.TIMEEVENT_WHEN, when);
		
		XMLUtility.xmlInstance.serializeNode(root, ModelPackage.TIMEEVENT_REDEFINEDWHEN, redefinedWhen);
		
		// references
		
	}
	
	public void deSerialize(Element root) {
		super.deSerialize(root);
		// attributes
		
		isRelative = XMLUtility.xmlInstance.deSerializeBoolean(root, ModelPackage.TIMEEVENT_ISRELATIVE);
		
		when = (ValueSpecification)XMLUtility.xmlInstance.deSerializeNode(root, ModelPackage.TIMEEVENT_WHEN, this);
		
		redefinedWhen = (TimeExpression)XMLUtility.xmlInstance.deSerializeNode(root, ModelPackage.TIMEEVENT_REDEFINEDWHEN, this);
		
		// references
		
	}
	
	public void dynamicSet(String featureID, Object value) {
		if(featureID == null || "".equals(featureID)) {
			return;
		}
		// attributes
		
		else if(ModelPackage.TIMEEVENT_WHEN.equals(featureID)) {
			when = (ValueSpecification)value;
		}
		
		else if(ModelPackage.TIMEEVENT_REDEFINEDWHEN.equals(featureID)) {
			redefinedWhen = (TimeExpression)value;
		}
		
		// references
		
		else
			super.dynamicSet(featureID, value);
	}
}
 
 
 
 
 